<?php

namespace app\common\model;

use think\Db;
use think\Model;

class StoreInvoice extends Model
{
    protected $table = 'ds_store_invoice';

    /**
     * 根据查找条件，筛选单条数据
     * @param string $field     查找字段
     * @param array $condition  查找条件
     */
    public function getOneItemByCondition($field = '*',$condition = [])
    {
        return  $this->field($field)->where($condition)->find();
    }
    /**
     * 根据查找条件，筛选多条数据
     * @param string $field     查找字段
     * @param array $condition  查找条件
     */
    public function getItemsByCondition($field = '*',$condition = [])
    {
        return  $this->field($field)->where($condition)->select();
    }

    /**
     * 新增发票索取记录
     * @param array $data
     */
    public function addInvoiceData($data = [])
    {
        return  $this->insertGetId($data);
    }
    /**
     * 更新发票索取记录
     * @param array $condition
     * @param array $data
     */
    public function updateInvoiceData($condition = [],$data = [])
    {
        return  $this->save($data,$condition);
    }
}